package com.dk.controller;


import com.dk.service.ProcedureService;
import com.dk.vo.ProcedureVO;
import com.dongdongshop.data.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 工序 前端控制器
 * </p>
 *
 * @author wbh
 * @since 2023-03-17
 */
@RestController
@RequestMapping("procedure")
public class ProcedureController {

    @Autowired
    private ProcedureService procedureService;

    @GetMapping("getInfoList")
    public Result getInfoList(ProcedureVO procedureVO) {
        List<ProcedureVO> procedureVOList = procedureService.getInfoList(procedureVO);
        return Result.OK().setData(procedureVOList);
    }

    @PostMapping("insertInfoProcedure")
    public Result insertInfoProcedure(ProcedureVO procedureVO) {
        procedureService.insertInfoProcedure(procedureVO);
        return Result.OK();
    }

    @GetMapping("getInfoProcedureById")
    public Result getInfoProcedureById(String procedureId) {
        ProcedureVO procedureVO = procedureService.getInfoProcedureById(procedureId);
        return Result.OK().setData(procedureVO);
    }

    @PostMapping("updateInfoProcedureById")
    public Result updateInfoProcedureById(ProcedureVO procedureVO) {
        procedureService.updateInfoProcedureById(procedureVO);
        return Result.OK();
    }

    @DeleteMapping("deleteInfoProcedureById")
    public Result deleteInfoProcedureById(String procedureId) {
        procedureService.deleteInfoProcedureById(procedureId);
        return Result.OK();
    }
}

